package main;

import java.util.Iterator;

import heteroset.*;

public class HeteroSetTest {
	public static void main(String[] args) {
		HeteroSet<Object> s1 = new HeteroHashSet<Object>();
		assert s1.size() == 0;
		assert s1.isEmpty();
		assert s1.add(Integer.class, 1);
		assert !s1.add(Integer.class, 1);
		assert s1.add(String.class, "one");
		assert s1.add(String.class, "two");
		assert s1.add(Boolean.class,true);
		assert s1.add(Boolean.class,false);
		assert s1.size() == 5;
		assert !s1.isEmpty();
		for (Object el : s1)
		System.out.println(el);
		Iterator<String> sit = s1.iterator(String.class);
		while (sit.hasNext())
		System.out.println(sit.next());
		Iterator<Double> dit = s1.iterator(Double.class);
		while (dit.hasNext())
		System.out.println(dit.next());
		assert s1.remove(String.class, "two");
		assert !s1.remove(String.class, "two");
		for (Object el : s1)
		System.out.println(el);
		HeteroSet<Number> s2 = new HeteroHashSet<Number>();
		assert s2.add(Integer.class, 1);
		assert s2.add(Integer.class, 2);
		assert s2.add(Double.class, 1.);
		assert s2.add(Double.class, 2.);
		assert s2.add(Long.class, 1L);
		assert s2.add(Long.class, 2L);
		assert s2.add(Number.class,1);
		Iterator<Integer> iit = s2.iterator(Integer.class);
		while (iit.hasNext())
		System.out.println(iit.next());
		Iterator<Long> lit = s2.iterator(Long.class);
		while (lit.hasNext())
		System.out.println(lit.next());
		dit = s2.iterator(Double.class);
		while (dit.hasNext())
		System.out.println(dit.next());
		for (Object el : s2)
		System.out.println(el);
		
		System.out.println("TESTS PASSED!");
	}
}
